From: Jasper St. Pierre Date: Mon, 3 Sep 2012 23:23:51 +0000 (-0300) Subject: grabHelper: Clean up the code a bit X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5925 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=be5df17a4aa6d3fb3e683ba30165b9efc5b94fbd;p=gnome-shell.git grabHelper: Clean up the code a bit I don't remember why I added needsGrab in the first place. --- diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index 4eb3065a1..a4392cc6b 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -10,11 +10,12 @@ const St = imports.gi.St; const Main = imports.ui.main; const Params = imports.misc.params; -function _navigateActor(actor, needsGrab) { +function _navigateActor(actor) { if (!actor) return; - if (needsGrab && actor instanceof St.Widget) + let needsGrab = true; + if (actor instanceof St.Widget) needsGrab = !actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false); if (needsGrab) actor.grab_key_focus(); @@ -169,7 +170,8 @@ const GrabHelper = new Lang.Class({ if (params.grabFocus) this._grabFocusCount++; - _navigateActor(newFocus, hadFocus); + if (hadFocus) + _navigateActor(newFocus); return true; }, @@ -254,7 +256,9 @@ const GrabHelper = new Lang.Class({ this._fullUngrab(wasModal); let poppedGrab = poppedGrabs[0]; - _navigateActor(poppedGrab.savedFocus, hadFocus); + + if (hadFocus) + _navigateActor(poppedGrab.savedFocus); }, _fullUngrab: function(wasModal) {